<template>
    <div>
        <div ref="main" style="width: 800px;height:600px;margin: 10px auto"></div>
    </div>
</template>

<script>
    export default {
        name: "DataManage",
        data(){
            return {

            }
        },
        methods : {
            initEcharts(){
                let myChart = this.$echarts.init(this.$refs['main']);
                let option = {
                    title: {
                        text: '各类文章统计',
                        subtext: '数量统计',
                        left: 'center'
                    },
                    tooltip: {
                        trigger: 'item'
                    },
                    legend: {
                        orient: 'vertical',
                        left: 'left',
                    },
                    series: [
                        {
                            name: '文章数量',
                            type: 'pie',
                            radius: '50%',
                            data: [
                                {value: 1048, name: '鸡汤文'},
                                {value: 735, name: '记录'},
                                {value: 580, name: '技术前沿'},
                                {value: 484, name: '言情'},
                                {value: 300, name: '科幻'}
                            ],
                            emphasis: {
                                itemStyle: {
                                    shadowBlur: 10,
                                    shadowOffsetX: 0,
                                    shadowColor: 'rgba(0, 0, 0, 0.5)'
                                }
                            }
                        }
                    ]
                };
                // 使用刚指定的配置项和数据显示图表。
                myChart.setOption(option);
            }
        },
        mounted() {
            this.initEcharts();
        }
    }
</script>

<style scoped>

</style>